﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace DataShow.codeDAL
{
    public class RankProcess
    {
        SqlHelper sqlhelper;
        public RankProcess()
        {
            sqlhelper = new SqlHelper();
        }
        public string GetNormalRank(string year, string month)
        {
            string sql = "select * from ForecasterRankReport where year=@year and month=@month";
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@year",year),
                new SqlParameter("@month",month)
            };
            DataTable dt = sqlhelper.ExecuteQuery(sql, param, CommandType.Text);
            if (dt.Rows.Count>0)
            {
                return dt.Rows[0]["value"].ToString();
            }
            else
            {
                return null;
            }
        }


        public DataTable GetAllForecasters()
        {
            string sql = "select username from account_forecaster where is_forcaster=1";
            return sqlhelper.ExecuteQuery(sql, CommandType.Text);
        }
    }
}